#include <stdio.h>
#include <stdlib.h>

#include "array_sentinel.h"

#define SENTINELLE '\0'

void set__empty(char * s) 
{
  s[0] = SENTINELLE;
}

int set__size (const char * s )
{
  int k;
  for(k=0; s[k] != SENTINELLE; k++);
  return k;
}

char* set__add( char * s, char c)
{
  if (set__find(s ,c)  == 0)
  {
    int l = set__size (s);
    s[l] = c;
    s[l+1] = SENTINELLE;
  }
  return s;
}

int set__find(const char * s, char c)
{
  int i;
  for (i=0; s[i] != SENTINELLE;i++)
  {
    if (s[i] == c) 
      return 1;
  }
  return 0;
}
